import { Commit } from "vuex";

interface IListState {
  img: string;
  name: string;
  api_id: string;
  jump_url: string;
  api_cid: string;
}

interface IFloors {
  name: string;
  image: string;
  label_name: string;
  label_image: string;
  label_url: string;
  list: IListState[];
}

interface ICates {
  cid: string;
  name?: string;
  text?: string;
  image: string;
  banner_img: string;
  banner_url: string;
  floors: IFloors[];
}

interface ILists {
  [key: string]: string;
}

interface IState {
  cates: Array<ICates>;
  lists: Array<ILists>;
}
interface IList {
  namespaced: boolean;
  state: IState;
  actions: {
    getCates: ({ commit }: { commit: Commit }) => void;
    getLists: (
      { commit }: { commit: Commit },
      {
        params,
      }: {
        params: {
          type: string;
          cid: string;
          r: string;
        };
      }
    ) => void;
  };
  mutations: {
    GET_CATES: (state: IState, { payload }: { payload: ICates[] }) => void;
    GET_LISTS: (state: IState, { payload }: { payload: ILists[] }) => void;
  };
}

export { IList, ILists, ICates };
